package com.witframework.web.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;

public class MaximizeWindowTag implements Tag {
	private PageContext pageContext;
	private Tag parent;
	private boolean cond = true;

	public void setCond(boolean paramBoolean) {
		this.cond = paramBoolean;
	}

	public boolean getCond() {
		return this.cond;
	}

	public int doStartTag() throws JspException {
		return 0;
	}

	public int doEndTag() throws JspException {
		StringBuffer localStringBuffer = new StringBuffer("");
		if (!(this.cond)) {
			dropData();
			return 6;
		}
		localStringBuffer.append("\n<script language=\"JavaScript\" type=\"text/javascript\">\n");
		localStringBuffer.append("top.window.moveTo(0,0);\n");
		localStringBuffer.append("if (document.all) top.window.resizeTo(screen.availWidth,screen.availHeight);\n");
		localStringBuffer.append("else {if (document.layers || document.getElementById)\n");
		localStringBuffer.append("if (top.window.outerWidth<screen.availWidth || top.window.outerHeight<screen.availHeight){\n");
		localStringBuffer.append("top.window.outerWidth=screen.availWidth; top.window.outerHeight=screen.availHeight;}}\n");
		localStringBuffer.append("</script>\n");
		try {
			this.pageContext.getOut().write(localStringBuffer.toString());
		} catch (Exception localException) {
			throw new JspException(localException.toString());
		}
		dropData();
		return 6;
	}

	public void release() {
		dropData();
	}

	private void dropData() {
		this.cond = true;
	}

	public void setPageContext(PageContext paramPageContext) {
		this.pageContext = paramPageContext;
	}

	public void setParent(Tag paramTag) {
		this.parent = paramTag;
	}

	public Tag getParent() {
		return this.parent;
	}
}
